﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Xml;
using Lib.Web.Mvc;

namespace Xsl.Transform.Controllers
{
    public class HomeController : Controller
    {
        #region Actions
        public ViewResult RenderXml()
        {
            XmlDocument cdCatalogDocument = new XmlDocument();
            cdCatalogDocument.Load(Server.MapPath("~/App_Data/CDCatalog.xml"));
            return View(cdCatalogDocument);
        }

        public XmlActionResult XmlResult()
        {
            XmlDocument cdCatalogDocument = new XmlDocument();
            cdCatalogDocument.Load(Server.MapPath("~/App_Data/CDCatalog.xml"));

            XmlActionResult result = new XmlActionResult();
            result.Document = cdCatalogDocument;
            result.TransformSource = Server.MapPath("~/Xsl/CDCatalog.xsl");
            return result;
        }
        #endregion
    }
}
